/* GUI CONVERTED from mgacsrp.p (converter v1.75) Sun Aug 13 17:08:35 2000 */
/* mgacsrp.p - GENERAL LEDGER ACCOUNT SECURITY REPORT                   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*K1B5*/
/*V8:ConvertMode=FullGUIReport                                 */
/* REVISION: 7.3          CREATED: 02/19/93       by: jms  *G708*       */
/* REVISION: 8.6    LAST MODIFIED: 11/20/97       by: bvm  *K1B5*       */


/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.0      LAST MODIFIED: 03/10/99   BY: *M0B8* Hemanth Ebenezer */
/* REVISION: 9.0      LAST MODIFIED: 03/13/99   BY: *M0BD* Alfred Tan       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/13/00 BY: *N0KR* myb                */
/*K1B5*/  /* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

/*K1B5*/  {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE mgacsrp_p_1 "Security Groups"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */


      define variable vpart like pt_part.
      define variable vpart1 like pt_part.
      DEFINE VARIABLE i AS INTEGER.
      DEFINE VARIABLE vdate  AS DATE LABEL "date".
      DEFINE VARIABLE vdate1 AS DATE.
      DEFINE VAR vamt LIKE pc_amt[1] .
      DEFINE TEMP-TABLE tmptab1 
          FIELD tmp1part LIKE pt_part
          FIELD tmp1list LIKE pc_list
          FIELD tmp1amt LIKE pc_amt[1].
      DEFINE TEMP-TABLE tmptab2
          FIELD tmppart LIKE pc_part LABEL "part"
          FIELD tmplist EXTENT 10 LIKE pc_list LABEL "vendor"
          FIELD tmpamt EXTENT 10  LIKE pc_amt[1] LABEL "amt"
          FIELD tmpscore EXTENT 10 LIKE pc_amt[1] FORMAT "->>>>9.99"  LABEL "score" .
/*       define variable groups as character format "x(72)" */
/*          label {&mgacsrp_p_1}.                           */

/*K1B5*  /* DISPLAY TITLE */
 * /*G708*/  {mfdtitle.i "b+ "} */

      /* DISPLAY SELECTION FORM */
      
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
      
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
vpart      colon 15  vpart1      colon 40 label {t001.i}
vdate      colon 15  vdate1      colon 40 label {t001.i}
           SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



      /* SET EXTERNAL LABELS */
      setFrameLabels(frame a:handle).

/*K1B5*/  {wbrp01.i}

          
/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

         if vpart1 = hi_char then vpart1 = "".
         IF vdate = low_date then vdate = ?.
         IF vdate1 = hi_date then vdate1 = ?.
/*K1B5*/     if c-application-mode <> 'web':u then
             
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K1B5*/     {wbrp06.i &command = update &fields = "  vpart vpart1 vdate vdate1" &frm = "a"}

/*K1B5*/ if (c-application-mode <> 'web':u) or
/*K1B5*/ (c-application-mode = 'web':u and
/*K1B5*/ (c-web-request begins 'data':u)) then do:

    if vpart1 = "" then vpart1 = hi_char.
    IF vdate = ? THEN  vdate = low_date.
    if vdate1 = ? then vdate1 = hi_date.

         /* CREATE BATCH INPUT STRING */
         bcdparm = "".
         {mfquoter.i vpart  }
         {mfquoter.i vpart1 }
         {mfquoter.i vdate  }
         {mfquoter.i vdate1 }

/*K1B5*/ end.

         /* SELECT PRINTER */
             
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



         {mfphead.i}
 /*              MESSAGE VPART  VPART1 VIEW-AS ALERT-BOX. */

FOR EACH pc_mstr FIELDS(PC_PART PC_LIST PC_AMT[1] PC_START PC_EXPIRE PC_CURR) NO-LOCK WHERE (pc_part >= vpart AND pc_part <= vpart1) AND (pc_expire > TODAY OR pc_expire = ?) BREAK BY pc_part BY pc_list BY pc_start BY pc_amt[1]  :
    IF LAST-OF(pc_list) THEN
    DO: 
     IF pc_curr <> "RMB" THEN DO:
         FIND exr_rate WHERE exr_start_date <= TODAY AND exr_end_date >= TODAY AND exr_curr2 = pc_curr NO-LOCK NO-ERROR.
         IF AVAILABLE exr_rate THEN vamt = pc_amt[1] * exr_rate.
     END.
     ELSE vamt = pc_amt[1].

         CREATE tmptab1.
         ASSIGN tmp1part = pc_part
                tmp1list = pc_list
                tmp1amt = vamt.
    END.
END.

FOR EACH tmptab1  NO-LOCK BREAK BY tmp1part BY tmp1amt BY tmp1list:
    i = i + 1.
    IF FIRST-OF(tmp1part) THEN do:
        CREATE tmptab2.
        ASSIGN tmppart = tmp1part
               tmplist[i] = tmp1list
               tmpamt[i]  = tmp1amt
               tmpscore[i]  = 100.
        vamt = tmp1amt.
    END.
    ELSE DO:
        FIND tmptab2 EXCLUSIVE-LOCK WHERE tmppart = tmp1part NO-ERROR.
        IF AVAIL tmptab2  THEN 
            SET tmplist[i] = tmp1list tmpamt[i]  = tmp1amt tmpscore[i] = 100 - (tmp1amt - vamt) / vamt * 100.
    END.
    IF LAST-OF(tmp1part) THEN i = 0 .

END.
i = 1. 
FOR EACH tmptab2 NO-LOCK :

    FIND pt_mstr NO-LOCK WHERE pc_part = pt_part NO-ERROR.
    IF AVAILABLE pt_mstr THEN
    DISP i FORMAT "->>>>>>9" LABEL "serial" tmppart pt_desc1 + pt_desc2 FORMAT "x(18)" LABEL "desc" pt_um  "RMB" LABEL "curr" tmplist[1] tmpamt[1] tmpscore[1]  tmplist[2] tmpamt[2] tmpscore[2]  tmplist[3] tmpamt[3] tmpscore[3]  tmplist[4] tmpamt[4] tmpscore[4]  tmplist[5] tmpamt[5] tmpscore[5]  tmplist[6] tmpamt[6] tmpscore[6] WITH WIDTH 600 WITH STREAM-IO.
    i = i + 1.
END.

         /* DISPLAY INFORMATION */
/*          for each ac_mstr where ac_code >= acc and ac_code <= acc1          */
/*                     and ac__qad02 <> "" no-lock                             */
/*                     with frame b width 132 no-attr-space:                   */
/*         /* SET EXTERNAL LABELS */                                           */
/*         setFrameLabels(frame b:handle).                                     */
/*         display ac_code ac_desc ac__qad02 @ groups WITH STREAM-IO /*GUI*/ . */
        
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/

/*          end. */

         /* REPORT TRAILER  */
         
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

      end.

/*K1B5*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" vpart vpart1 vdate vdate1 "} /*Drive the Report*/
